<%--
    Document   : Registrazione.jsp
    Created on : 13-apr-2010, 20.10.48
    Author     : Rachid Ouchary, Fabio Strocco, Max Passaghe, Marco Tansini.
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" import="servlet.ServletUtil" import="entity.Utente"
        import="java.util.List"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<script type="text/javascript" src="javascript/scroll.js"></script>
<%
            List<Utente> result = (List<Utente>) request.getAttribute(ServletUtil.PARAM_LISTA_RICERCA);
            Utente current = (Utente) request.getAttribute(ServletUtil.PARAM_UTENTE);
            int size = result.size();
%>
<h1><%if (size > 0) {%> <%= size%> <% } else {%> Nessun <%}%>
    <%if (size > 1) {%> risultati trovati<% } else {%> risultato trovato <%}%></h1>
<table width="496" class="tableItemList" >
    <%for (Utente user : result) {%>
    <tr>
        <td width="36" rowspan="2" class="tdBull"><img src="images/user_icon.png" /></td>
        <td width="290" ><span class="descrizione"><%=user.getUsername()%></span><br />
            <a class="categoria" href="mailto:xcvzxc"><%=user.getMail()%></a></td>
        <td width="148" class="nomeCampo" >
            <form action="MainDispatcher?operation=<%= ServletUtil.ACTION_VISUALIZZA_WISHLIST %>"" method="post" name="addAmico" target="_self">
                  <input name="visualizzaWl" type="image" value="visualizzaWl" src="images/visualizzaWl.png" style="padding-right:1px;"/>
                  <input name="<%= ServletUtil.PARAM_USERNAME_AMICO%>" type="hidden" value="<%=user.getUsername()%>" />
            </form>
            <%if (ServletUtil.isLogged(session) && !current.hasAmico(user)) {%>
            <form action="MainDispatcher?operation=<%= ServletUtil.ACTION_AGGIUNGI_AMICO%>"" method="post" name="addAmico" target="_self">
                  <input name="addAmico" type="image" value="addAmico" src="images/aggiungiAmico.png" />
                  <input name="<%= ServletUtil.PARAM_USERNAME_AMICO%>" type="hidden" value="<%=user.getUsername()%>" />
            </form>
            <%}%>
        </td>
    </tr>
    <tr>
        <td colspan="3"><div class="dhtmlgoodies_question">Visualizza dettagli</div>
            <div class="dhtmlgoodies_answer">
                <div>
                    <table width="300" border="0px" >
                        <tr>
                            <td width="80"><span class="itemLabel">Nome: </span></td>
                            <td width="204"><span class="itemLabel"><%=user.getNome()%></span></td>
                        </tr>
                        <tr>
                            <td><span class="itemLabel">Cognome: </span></td>
                            <td><span class="itemLabel"><%=user.getCognome()%></span></td>
                        </tr>
                        <tr>
                            <td><span class="itemLabel">Città : </span></td>
                            <td><span class="itemLabel"><%=user.getCitta()%> </span></td>
                        </tr>
                        <tr>
                            <td><span class="itemLabel">Professione: </span></td>
                            <td><span class="itemLabel"><%=user.getProfessione()%></span></td>
                        </tr>
                    </table>
                </div>
            </div>
            <br/></td>
    </tr>
    <%}%>
</table>